package main

import "encoding/json"

type person struct {
	Id   int    `json:"id"`//通过tag将公开Id映射为json的id
	Name string `json:"name"`//通过tag将公开Name映射为json的name
}

func NewPerson(id int, name string) *person {
	return &person{
		Id:   id,
		Name: name,
	}
}

func main() {
	p:=NewPerson(1, "p")
	json.Marshal(p)
}
